﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using Base.Abstract;


namespace GUI.Controls
{
	public enum TpButtonTooltip
	{
		Default,
		True,
		False
	}

	public class TpButton : Button
	{
		#region Members

		private const int smallSize = 19;
		private const int normalSize = 24;
		private TpToolTip toolTip = new TpToolTip();

		#endregion

		#region Construction

		public TpButton()
		{

		}

		#endregion

		#region Tasks

		private void InitializeTask()
		{
			
		}

		private void TaskPropertyChanged(string propertyName)
		{
			if (propertyName != "Enabled" )
			{
				return;
			}

			
		}

		

		#endregion

		#region Properties

		private TpButtonTooltip showTooltip;
		public TpButtonTooltip ShowTooltip
		{
			get
			{
				return showTooltip;
			}
			set
			{
				showTooltip = value;
			}
		}

		public AbstractTpObject Model
		{
			get;
			set;
		}

		#endregion

		#region Pressed Property

		public delegate void PressedEventHandler(bool buttonDown);
		public event PressedEventHandler Pressed;

		private Color originalColor = SystemColors.Control;
		internal void TbdButton_Click(object sender, EventArgs e)
		{
			if (Pressable && (Control.ModifierKeys == Keys.Control))
			{
				pressedValue = !pressedValue;
				if (pressedValue)
				{
					originalColor = this.BackColor;
					this.BackColor = Color.Red;
				}
				else
				{
					this.BackColor = originalColor;
				}
				if (Pressed != null)
					Pressed(pressedValue);
			}
			
			
		}

		

		private bool pressedValue;
		[Browsable(false)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public bool ButtonPressed
		{
			get
			{
				return pressedValue;
			}
		}

		

		private bool pressableValue;
		[DefaultValue(false)]
		public bool Pressable
		{
			get
			{
				return pressableValue;
			}
			set
			{
				pressableValue = value;
			}
		}

		

		#endregion

	}
}
